package com.yuexinduo.education.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.yuexinduo.education.R;
import com.yuexinduo.baselibrary.base.BaseListAdapter;
import com.yuexinduo.education.bean.HomeSubjectsBean;

import java.util.List;

public class HomeSubjectsAdapter  extends BaseListAdapter<HomeSubjectsBean> {
    private Context mContext;
    public HomeSubjectsAdapter(Context context, List<HomeSubjectsBean> list) {
        super(context, list);
        this.mContext=context;
    }

    @Override
    public View initView(HomeSubjectsBean homeSubjectsBean, View convertView, ViewGroup parent, int pos) {
        ViewHolder mViewHolder;
        if (convertView == null){
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_home_subjects,parent,false);
            mViewHolder = new ViewHolder();
            mViewHolder.itemSubjects = (TextView) convertView.findViewById(R.id.item_subjects);
            convertView.setTag(mViewHolder);
        }else {
            mViewHolder = (ViewHolder) convertView.getTag();
        }
        mViewHolder.itemSubjects.setText(homeSubjectsBean.getName());

        return convertView;
    }
    class ViewHolder{

        private TextView itemSubjects;
    }
}
